
// 路由配置
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'


/**
 *  Typescript ts
 *    类型化js
 * */

const routes: Array<RouteRecordRaw> = [
    {
        path:'/',
        name:'Home',
        component:()=>import('../App.vue'),
    },{
        path:'/test',
        name:'Test',
        component:()=>import('../views/test/Test.vue')
    },{
        path:'/bus',
        name:'Bus',
        component:()=>import('../views/Bussiness.vue')
    },{
       path:'/test2',
        name:"Test",
        component:()=>import('../views/layout/Index.vue'),
        children:[
            {
                path:'bus',
                name:'Buss',
                component:()=>import('../views/Bussiness.vue')
            },
            {
                path:'test2',
                name:'Test2',
                component:()=>import('../views/test/Test.vue')
            }
        ]
    },{
         path:'/site',
         name:'Site',
         component:()=>import('../views/website/Index.vue'),
         children:[
             {
                 path:'list',
                 name:'List',
                 component:()=>import('../views/website/components/List.vue')
             },{
                 path:'detail',
                 name:'Detail',
                 component:()=>import('../views/website/components/Details.vue')
             },{
                  path:'mine',
                  name:'Mine',
                  component:()=>import('../views/website/components/Mine.vue')
             },{
                 path:'kefu',
                 name:'Kefu',
                 component:()=>import('../views/website/components/Kefu.vue')
             }
         ]
    }



]

const router = createRouter({
    history:createWebHistory(),
    routes
})

// 路由守卫
router.beforeEach((to,from,next) => {
    next()
})



export default router